let list = document.querySelector('#list')
let el = "";
fetch('http://chst.vip:1234/api/getinlanddiscount')
.then(body => body.json())
.then(res => {
    console.log(res)
    res.result.forEach(item => {
        let reg = /(?<=imgurl=)[^'"]*/;
        // let r = item.productImg2.match(reg);
        el += `<div productid=${item.productId}>
        
        <h3>${item.productName}</h3>
        <p>${item.productPinkage}</p>
        <span>${item.productTime} ${item.productTips}</span>
    </div>`
    })
    list.innerHTML = el;
    
    list.onclick=function(e){
        if(e.target.localName=="div"){
            let _this = e.target;
            console.log(_this)
            
            let id =_this.getAttribute('productid')
            location.href='countryDetail.html?productid='+ id
        }
    }
})

{/* <img src=${r[0]}> */}